-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated this for ya! #5
Open
FashyGainz
wants to merge
15
commits into
shirosaidev:master
Choose a base branch
from
FashyGainz:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1. New Argument (--nmapdatadir): Users can specify their own NSE script directory using this argument. If they don't, the script will look for it in default directories. 2. Directory Check: If the user provides a directory that doesn’t exist, the script will notify them and exit. 3. Dynamic NSE Script Path Detection: If no custom path is given, the script will try to locate it using common paths (/usr/local/share/nmap/scripts, /usr/share/nmap/scripts). 4. Error Handling for Missing Directories: If the script cannot find the NSE script directory, it will exit with an error message.
Function erroring out because it assumes nfsls4 exists which is risky af. The condition if len(nfsls) > 4 ensures that nfsls[4] exists before attempting to access it. This prevents the IndexError from being raised when nfsls has fewer elements.
moved the get_host_ranges method into the sniffer class, ensuring that it can be accessed using self.get_host_ranges() as expected
expand_cidr Method: This method takes a CIDR notation (like 10.185.80.0/24) and expands it into individual IP addresses using the ipaddress module. It handles errors if an invalid CIDR is provided. Modified sniff_hosts: When CIDR notation is detected in the hosts string, it expands the range using the expand_cidr method. This generates a list of individual IP addresses that can be scanned.
self.nm.all_hosts(): This method returns a list of all hosts that Nmap scanned and returned results for. If the target host (host) is not in this list, it means Nmap couldn't get any information for that host. Logging: A warning is logged when Nmap does not return results for a host, which could help in debugging why a particular host was skipped. Graceful Return: If the host is not in the scan results, the method returns the host and the empty open_ports dictionary, skipping further processing.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
added concurrency
added better error handling
Made it possible to use cidr notation for scanning
added default nmapargs